package com.bcntouch.touch2act;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;

import com.bcntouch.touch2act.Contribute.ContributeActivity;
import com.bcntouch.touch2act.Suggest.SuggestActivity;
import com.bcntouch.touch2act.User.InitUserActivity;
import com.bcntouch.touch2act.User.PublicProfileActivity;
import com.bcntouch.touch2act.User.User;

public class DashboardActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        // Check if there is a user already
        User currentUser = User.getCurrentUser(this);
        if (currentUser == null) {
        	// No user, go to InitUserActivity
        	Intent intent = new Intent(this, InitUserActivity.class);
        	startActivity(intent);
        	finish();
        }
        
        setContentView(R.layout.activity_dashboard);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_dashboard, menu);
        return true;
    }
    
    public void onConservaButtonClick(View view) {
    	Intent intent = new Intent(this, ContributeActivity.class);
    	startActivity(intent);
    }
    
    public void onProposaButtonClick(View view) {
    	Intent intent = new Intent(this, SuggestActivity.class);
    	startActivity(intent);
    }
    
    public void onMyProfileButtonClick(View view) {
    	Intent intent = new Intent(this, PublicProfileActivity.class);
    	startActivity(intent);
    }
    
}
